package com.utils.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;


/**
 * 用户表
 * @TableName user
 */
@TableName(value ="user")
@Data
@NoArgsConstructor
public class User implements Serializable {
    /**
     * 自增ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名
     */
    @NotNull(message = "账号不能为空")
    private String username;

    /**
     * 手机号码
     */
    @NotNull(message = "手机号码不能为空")
    private String phone;

    @Email(message = "邮箱密码不能为空")
    private String email;

    @TableField(exist = false)
    private List<Role> roles;

    @TableField(exist = false)
    private List<Customer> customers;

    @TableField(exist = false)
    private String token;

    @TableField(exist = false)
    private String TokenID;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public User(String username, String phone, String email) {
        this.username = username;
        this.phone = phone;
        this.email = email;
    }
}